Skip to content

fix(organizations): leave a content path without kustomization.yaml to Flux's generated kustomization - #503

Merged
fiunchinho merged 4 commits into
mainfrom
content-path-generated-kustomization
Nov 30, 2026
Merged

fiunchinho merged 4 commits into
mainfrom
content-path-generated-kustomization

Conversation

@fiunchinho

Copy link
Copy Markdown
Member

Part of #498

Problem

Item 2 of #498 (R1-1). An organization's content path can have no kustomization.yaml: git did not get one from create_organization in mode commit, for example for an organization created in mode apply. Flux then generates the content path's kustomization from its files, with agent-manager/ of the agent tools. The next organization write in mode commit (contentWriter.land → orgCommit.open → layout.Build) created kustomization.yaml with the write's own files only. After the merge, the organization's Kustomization no longer built agent-manager/ or the other files, and with prune it removed the agents.

Change

  • In an organization's content path whose base branch has no kustomization.yaml, an organization write in mode commit does not create one, and does not change the kustomization above the content path (leaveToFlux, internal/organizations/commit.go). Flux continues to generate the list. This applies to contentWriter.land and to the credential operations (prepareCredentialCommit), to dry runs, and to writes that only remove a file.
  • A write that removes a file there adds <content path>/.gitkeep when git does not have it (one read, no listing). Git keeps no empty directory, and the organization's Kustomization fails on a path that does not exist and prunes nothing. Flux's generator lists YAML files only, so the .gitkeep changes nothing that Flux applies. delete_organization removes it with the content path.
  • A content path with kustomization.yml or Kustomization gets no second kustomization file.
  • When the content path has a kustomization.yaml, nothing changes. create_organization still writes the empty kustomization.yaml of a new content path, and the objects path does not change.
  • The agent tools do not change. Content paths whose first agent merged before this fix are covered too: the fix is on the organization side.
  • docs/organizations-commit-mode.md: one bullet states the rule.

Tests

  • TestAnOrganizationWriteAfterItsFirstAgentKeepsTheAgent (internal/api): create_agent in mode commit into a content path without kustomization.yaml, merge, then set_organization_egress_policy in mode commit: the pull request adds no kustomization.yaml, and the agent's files stay. Fails on main.
  • TestOrganizationWritesLeaveAContentPathWithoutKustomizationToFlux: a content path whose agent an older agent-manager merged; a dry run, a write that only removes a file, a content path with kustomization.yml, and a kustomization above the content path with and without its entry. Fails on main.
  • TestRemovingTheLastContentObjectKeepsTheContentPath: the removal of the last object keeps the path, with resources: [] where a kustomization.yaml exists, and with a .gitkeep (written only when git lacks it) where Flux generates the list.
  • TestCredentialOperationCommitsConsumerAndEncryptedSecretTogether: a credential operation creates no content-path kustomization.yaml. Fails on main.
  • TestDeleteOrganizationInCommitModeTakesTwoSteps: the delete removes the .gitkeep with the content path.

The change does not touch cmd/serve.go, internal/agents/service.go or internal/api/mcp.go (#483).

Review

First review (Opus, gs-base:review-pr) and second review (Codex, 3 rounds, approved on cd2f02d).

Id Severity Outcome Finding
F1 non-blocking deferred, #502 A content path with kustomization.yml or Kustomization never lists the written objects.
F2 non-blocking fixed No test for the kustomization above the content path.
F3 non-blocking fixed Part of on a line of its own in this body.
R1-1 blocking fixed A removal that empties a content path without kustomization.yaml removed the directory, so Flux pruned nothing. Fixed with the .gitkeep.
R1-2 important deferred, #502 Same defect as F1.
R2-1 blocking fixed An interim fix wrote resources: [], which pruned an agent merged in parallel. The .gitkeep replaces it.
R2-2 blocking fixed The interim listing did not see Git submodules. The .gitkeep needs no listing.
R2-3 important accepted The interim listing failed on very large repository trees. The .gitkeep needs no listing, so this no longer applies.

#502 also holds two older defects found in this work: the parent step of layout.Build lists a directory only in a kustomization.yaml, and delete_agent of the last agent of a content path without kustomization.yaml removes the directory.

…o Flux's generated kustomization

An organization write in mode commit into a content path without a kustomization.yaml (an organization created in mode apply) created one with its own files only, and the organization's Kustomization then pruned agent-manager/ and every other file that Flux had generated the list from. The write no longer creates that file, also not in a dry run or a credential operation, so Flux keeps generating the list. Part of #498.
A removal of the last file of a content path without kustomization.yaml writes the file with resources: [], so the path stays and Flux prunes. Test the kustomization above the content path, and say in the docs that a kustomization.yml gets no entry.
…tkeep

A removal into a content path without kustomization.yaml adds a .gitkeep when git lacks it, instead of listing the path and writing resources: []. Flux keeps generating the list, so an agent merged in parallel or a submodule stays, and the path never disappears.
@circleci-architect

Copy link
Copy Markdown

Published Helm chart agent-manager

3.5.12-rbea61a4ft20261130111713h6c93f98
Chart agent-manager
Version 3.5.12-rbea61a4ft20261130111713h6c93f98
OCI reference oci://gsoci.azurecr.io/charts/giantswarm/agent-manager:3.5.12-rbea61a4ft20261130111713h6c93f98
Digest sha256:b4703f787043cd652950548f5bedace5bea26282b06daeb71bcdedbd1dd35464
Registry public — gsoci.azurecr.io
Git catalog giantswarm-test-catalog (index)
Pull this chart
helm pull oci://gsoci.azurecr.io/charts/giantswarm/agent-manager --version 3.5.12-rbea61a4ft20261130111713h6c93f98

Posted by architect-orb · build 13563 · commit 6c93f98 · updated in place on every push

@fiunchinho
fiunchinho merged commit 38d94b2 into main Nov 30, 2026
18 checks passed
@fiunchinho
fiunchinho deleted the content-path-generated-kustomization branch November 30, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant